package com.bibi.hanshunping.chapter06;

public class ArrayAdd {
    public static void main(String[] args) {
        // 扩容，用已有的知识
        int[] arr1 = {1, 2, 3};
        int[] arr2 = new int[arr1.length + 1];
        for (int i = 0; i < arr1.length; i++) {
            arr2[i] = arr1[i];
        }
        arr2[arr2.length - 1] = 4;

        for (int i = 0; i < arr2.length; i++) {
            System.out.println(arr2[i]);
        }
    }
}
